package com.example.demo.mapper;

import com.example.demo.model.entity.ReserveNumber;
import com.example.demo.model.entity.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface ReserveMapper {

    @Results(id = "userResult", value = {
            @Result(property = "userName", column = "user_name", id = true),
            @Result(property = "passWord", column = "pass_word"),
    })

    @Insert("INSERT INTO t_reserve_number (user_name) VALUES (#{userName})")
    void newNumber(User user);

    @Delete("DELETE FROM t_reserve_number WHERE user_name = #{userName}")
    void deleteNumber(User user);


    // TODO: 出队
    ReserveNumber nextNumber();


    ReserveNumber numberNow();
}
